package client.view.keys;

import java.awt.event.KeyEvent;
import java.util.HashMap;

public class Keys {
	public enum Key{
		none(""),
		up("up"),
		down("down"),
		left("left"),
		right("right"),
		jump("jump");
		
		private String code;
		
		private Key(String s){
			code=s;
		}
		
		public String toString(){
			return code;
		}
	}
	
	private HashMap<Integer, Key> keys;
	
	public Keys(){
		keys=new HashMap<Integer, Key>();
		
		keys.put(KeyEvent.VK_DOWN, Key.down);
		keys.put(KeyEvent.VK_UP, Key.up);
		
		keys.put(KeyEvent.VK_LEFT, Key.left);
		keys.put(KeyEvent.VK_RIGHT, Key.right);
		
		keys.put(KeyEvent.VK_ALT, Key.jump);
	}

	public Key getKey(int keyCode) {
		if(!keys.containsKey(keyCode))
			return Key.none;
		
		return keys.get(keyCode);
	}

}
